<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<body>
<script src="../static/js/jquery.js" th:href="@{/js/jquery.js}"></script>
<script src="../static/lib/bootstrap/js/bootstrap.min.js" th:href="@{/lib/bootstrap/js/bootstrap.min.js}"></script>
<link href="../static/lib/bootstrap/css/bootstrap.min.css" th:href="@{/lib/bootstrap/css/bootstrap.min.css}"
      rel="stylesheet">
<link rel="stylesheet" href="../static/css/login.css" th:href="@{/css/login.css}">

<style>
    .show {
        display: block;
    }

    .hide {
        display: none;
    }
</style>

<div class="row" th:replace="_fragments :: menu(0)"></div>

<!--用户登陆-->
<div class="container show" id="login">
    <div class="page-header">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="loginModalLabel">登录</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="phone" class="form-control"
                                       id="login_phone" placeholder="手机号码 / Phone"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="password" name="password" class="form-control"
                                       id="login_password" placeholder="密码 / Password"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input class="l_btn btn" type="button" id="login_btn" style="color: #fff;"
                                       value="登录"/>
                            </div>
                        </div>
                    </form>
                    <div class="form-group l_text_align">
                        <a href="#" class="l_a" onclick="goto_register()">立即注册</a>
                        <span>|</span>
                        <a href="#" class="l_a" onclick="goto_found()">忘记密码？</a>
                    </div>
                    <br>
                    <div class="form-group l_text_align">
                        <a href="#" class="l_a" onclick="goto_leader()">负责人入口</a>
                        <span>|</span>
                        <a href="#" class="l_a" onclick="goto_admin()">管理员入口</a>
                    </div>
                    <br>

                    <div class="form-group l_text_align">
                        <h5>———————— 第三方账号登陆 ————————</h5>
                    </div>
                    <div class="form-group l_text_align">
                        <div class="l_line_wh l_line_icon">
                            <div class="l_icon l_wechat_icon" style="float: left">
                                <a href="#" class="icon-wechat "></a>
                            </div>
                            <div class="l_icon l_qq_icon" style="float: left;margin-left: 20px">
                                <a href="#" class="icon-qq "></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--负责人登陆-->
<div class="container hide" id="leader">
    <div class="page-header">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">负责人登录</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="phone" class="form-control"
                                       id="leader_phone" placeholder="手机号码 / Phone"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="password" name="password" class="form-control"
                                       id="leader_password" placeholder="密码 / Password"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input class="l_btn btn" type="button" id="leader_btn" style="color: #fff;"
                                       value="登录"/>
                            </div>
                        </div>
                    </form>
                    <div class="form-group l_text_align">
                        <a href="#" class="l_a" onclick="goto_login()">返回登陆</a>
                        <span>|</span>
                        <a href="#" class="l_a" onclick="goto_admin()">管理员入口</a>
                    </div>
                    <br>
                </div>
            </div>
        </div>
    </div>
</div>

<!--管理员登陆-->
<div class="container hide" id="admin">
    <div class="page-header">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">管理员登录</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="phone" class="form-control"
                                       id="admin_phone" placeholder="手机号码 / Phone"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="password" name="password" class="form-control"
                                       id="admin_password" placeholder="密码 / Password"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input class="l_btn btn" type="button" id="admin_btn" style="color: #fff;"
                                       value="登录"/>
                            </div>
                        </div>
                    </form>
                    <div class="form-group l_text_align">
                        <a href="#" class="l_a" onclick="goto_login()">返回登陆</a>
                        <span>|</span>
                        <a href="#" class="l_a" onclick="goto_leader()">负责人入口</a>
                    </div>
                    <br>
                </div>
            </div>
        </div>
    </div>
</div>

<!--注册账号-->
<div class="container hide" id="register">
    <div class="page-header">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="regModalLabel">注册账号</h4>
                    <span id="reg_mes" class="hide" style="float:right;padding-right: 50px;color: #ff7d15">注册失败</span>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" method="post">
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="name" class="form-control"
                                       id="register_name" placeholder="昵称 / Name"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="password" class="form-control"
                                       id="register_password" placeholder="密码 / Password"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="phone" class="form-control"
                                       id="register_phone" placeholder="手机号码 / Phone"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line" style="float: left">
                                <input type="text" name="code" class="form-control"
                                       id="register_code" placeholder="验证码 / Code"> <span
                                    class="help-block"></span>
                            </div>
                            <div style="float: left;padding-left: 20px;padding-top: 8px;">
                                <button class="btn" type="button" id="code_btn"
                                        style="color: #fff;background-color: #00b5ad;">发送短信
                                </button>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="l_line_wh">
                                <input class="l_btn btn" type="button" id="register_btn" style="color: #fff;"
                                       value="注册"/>
                            </div>
                        </div>
                    </form>
                    <div class="form-group l_text_align">
                        <a href="#" class="l_a" onclick="goto_login()">返回登陆</a>
                        <span>|</span>
                        <a href="#" class="l_a" onclick="goto_found()">忘记密码？</a>
                    </div>
                    <br><br>
                    <div class="form-group l_text_align">
                        <h5>———————— 第三方账号登陆 ————————</h5>
                    </div>
                    <div class="form-group l_text_align">
                        <div class="l_line_wh l_line_icon">
                            <div class="l_icon l_wechat_icon" style="float: left">
                                <a href="#" class="icon-wechat "></a>
                            </div>
                            <div class="l_icon l_qq_icon" style="float: left;margin-left: 20px">
                                <a href="#" class="icon-qq "></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--找回密码-->
<div class="container hide" id="found">
    <div class="page-header">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="findModalLabel">找回密码</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="phone" class="form-control"
                                       id="found_phone" placeholder="手机号码 / Phone"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line" style="float: left">
                                <input type="text" name="code" class="form-control"
                                       id="found_code" placeholder="验证码 / Code"> <span
                                    class="help-block"></span>
                            </div>
                            <div style="float: left;padding-left: 20px;padding-top: 8px;">
                                <button class="btn" type="button" id="found_code_btn"
                                        style="color: #fff;background-color: #00b5ad;">发送短信
                                </button>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input type="text" name="password" class="form-control"
                                       id="found_password" placeholder="新密码 / NewPassword"> <span
                                    class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="l_line_wh">
                                <input class="l_btn btn" type="button" onClick="found()" style="color: #fff;"
                                       value="确定"/>
                            </div>
                        </div>
                    </form>
                    <div class="form-group l_text_align">
                        <a href="#" class="l_a" onclick="goto_login()">返回登陆</a>
                        <span>|</span>
                        <a href="#" class="l_a" onclick="goto_register()">返回注册</a>
                    </div>
                    <br><br>
                    <div class="form-group l_text_align">
                        <h5>———————— 第三方账号登陆 ————————</h5>
                    </div>
                    <div class="form-group l_text_align">
                        <div class="l_line_wh l_line_icon">
                            <div class="l_icon l_wechat_icon" style="float: left">
                                <a href="#" class="icon-wechat "></a>
                            </div>
                            <div class="l_icon l_qq_icon" style="float: left;margin-left: 20px">
                                <a href="#" class="icon-qq "></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    var phone;
    $("#code_btn").click(function () {
        phone = $("#register_phone").val();
        var regPhone = /^1[3-9]\d{9}$/;
        if (phone.length === 0) {
            show_validate_ms("#register_phone", "error", "手机号码不能为空");
        } else if (!regPhone.test(phone)) {
            //alert("邮箱格式不正确");
            //应该清空这个元素之前的样式
            show_validate_ms("#register_phone", "error", "手机号码格式不正确");
        } else {
            show_validate_ms("#register_phone", "success", "");
            $.ajax({
                url: "/get_code",
                type: "post",
                dataType: "json",
                data: {"phone": phone},
                success: function (result) {
                    if (result.code === 200) {
                        show_validate_ms("#register_phone", "success", "发送成功，注意查收");
                        checkCode(60);
                    } else if (result.code === 201) {
                        show_validate_ms("#register_phone", "error", "该号码已注册");
                        checkCode(2);
                    }
                    // else if(result.code=== 404){
                    //     alert("该手机号码未注册");
                    //     checkCode(2);
                    // }else if(result.code=== 100){
                    //     alert("审核中请稍后。。。");
                    //     checkCode(2);
                    // }else if(result.code=== 500){
                    //     alert("审核未通过。。。");
                    //     checkCode2(2);
                    // }else if(result.code=== 301){
                    //     checkCode2(2);
                    //     alert("余额不足，请联系管理员");
                    // }else if(result.code=== 300){
                    //     checkCode2(60);
                    //     alert("短信发送频率繁忙");
                    // }
                }
            });
        }
    });

    //校验表单数据
    function validate_add_form() {
        //1、校验昵称
        var name = $("#register_name").val();
        var regName = /(^[a-zA-Z0-9_-]{4,16}$)|(^[\u2E80-\u9FFF]{2,6})/;
        if (name.length === 0) {
            show_validate_ms("#register_name", "error", "昵称不能为空");
            return false;
        } else if (!regName.test(name)) {
            show_validate_ms("#register_name", "error", "昵称由2-6位中文或者4-16位英文和数字的组合");
            return false;
        } else {
            show_validate_ms("#register_name", "success", "");
        }
        //2.校验密码
        var password = $("#register_password").val();
        var regPassword = /(^[a-zA-Z0-9_-]{4,16}$)/;
        if (password.length === 0) {
            show_validate_ms("#register_password", "error", "密码不能为空");
            return false;
        } else if (!regPassword.test(password)) {
            show_validate_ms("#register_password", "error", "密码由4-16位英文和数字的组合");
            return false;
        } else {
            show_validate_ms("#register_password", "success", "");
        }
        //3、校验电话信息
        var phone1 = $("#register_phone").val();
        var regPhone = /^1[3-9]\d{9}$/;
        if (phone1.length === 0) {
            show_validate_ms("#register_phone", "error", "手机号码不能为空");
            return false;
        } else if (!regPhone.test(phone1)) {
            show_validate_ms("#register_phone", "error", "手机号码格式不正确");
            return false;
        } else if (phone !== phone1) {
            show_validate_ms("#register_phone", "error", "手机号码不一致");
            return false;
        } else {
            show_validate_ms("#register_phone", "success", "");
        }
        //4、验证码
        var code = $("#register_code").val();
        if (code.length === 0) {
            show_validate_ms("#register_code", "error", "验证码不能为空");
            return false;
        } else {
            show_validate_ms("#register_code", "success", "");
        }
        return true;
    }

    $("#register_btn").click(function () {
        if (!validate_add_form()) {
            return false;
        }
        var code = $("#register_code").val();
        $.ajax({
            url: "/add_user/" + code,
            data: $("#register form").serialize(),
            type: "POST",
            dataType: "json",
            success: function (result) {
                if (result.code === 500) {
                    show_validate_ms("#register_code", "error", "验证码错误");
                }
                else if (result.code === 444) {
                    show_validate_ms("#register_code", "error", "验证码失效");
                }
                else if (result.code === 100) {
                    reset_form("#register form");
                }
                else {
                    show_validate_ms("#register_code", "success", "");
                }
                if (result.code === 200) {
                    var login1 = document.getElementById("login");
                    login1.className = login1.className.replace("hide", "show");

                    var register1 = document.getElementById("register");
                    register1.className = register1.className.replace("show", "hide");

                    reset_form("#register form");
                }
            }

        });
    });

    $("#login_btn").click(function () {
        var phone = $("#login_phone").val();
        if (phone.length === 0) {
            show_validate_ms("#login_phone", "error", "账号不能为空");
            return false;
        } else {
            show_validate_ms("#login_phone", "success", "");
        }

        var password = $("#login_password").val();
        if (password.length === 0) {
            show_validate_ms("#login_password", "error", "密码不能为空");
            return false;
        } else {
            show_validate_ms("#login_password", "success", "");
        }

        $.ajax({
            url: "/check_mes",
            type: "post",
            dataType: "json",
            data: {"phone": phone, "password": password},
            success: function (result) {
                if (result.code === 100) {
                    show_validate_ms("#login_password", "error", "密码有误");
                } else {
                    show_validate_ms("#login_password", "success", "");
                }

                if (result.code === 404) {
                    show_validate_ms("#login_phone", "error", "账号不存在");
                    reset_form("#login_password");
                } else {
                    show_validate_ms("#login_phone", "success", "");
                }

                if (result.code === 200) {
                    window.location.href = '/';
                }
            }
        })
    });

    //注册验证码倒计时
    function checkCode(time) {
        if (time === 0) {
            $("#code_btn").removeAttr("disabled");//这个表示，从xx中移除yy属性，$(xx).remove()，移除xx元素
            $("#code_btn").html("重新发送");
        } else {
            time--;
            $("#code_btn").attr("disabled", true);
            $("#code_btn").html("倒计时" + time + "s");
            setTimeout(function () {//setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式。1秒
                checkCode(time);
            }, 1000);
        }
    }


    $("#admin_btn").click(function () {
        var phone = $("#admin_phone").val();
        if (phone.length === 0) {
            show_validate_ms("#admin_phone", "error", "账号不能为空");
            return false;
        } else {
            show_validate_ms("#admin_phone", "success", "");
        }

        var password = $("#admin_password").val();
        if (password.length === 0) {
            show_validate_ms("#admin_password", "error", "密码不能为空");
            return false;
        } else {
            show_validate_ms("#admin_password", "success", "");
        }

        $.ajax({
            url: "/admin_login",
            type: "post",
            dataType: "json",
            data: {"phone": phone, "password": password},
            success: function (result) {
                if (result.code === 100) {
                    show_validate_ms("#admin_phone", "error", "此账号无权限");
                } else {
                    show_validate_ms("#admin_phone", "success", "");
                }

                if (result.code === 404) {
                    show_validate_ms("#admin_phone", "error", "账号错误");
                    show_validate_ms("#admin_password", "error", "密码错误");
                } else {
                    show_validate_ms("#admin_phone", "success", "");
                    show_validate_ms("#admin_password", "success", "");
                }

                if (result.code === 200) {
                    window.location.href = "/admin/index";
                }
            }
        })
    })



    var phone;
    $("#found_code_btn").click(function () {
        phone = $("#found_phone").val();
        var regPhone = /^1[3-9]\d{9}$/;
        if (phone.length === 0) {
            show_validate_ms("#found_phone", "error", "手机号码不能为空");
        } else if (!regPhone.test(phone)) {
            show_validate_ms("#found_phone", "error", "手机号码格式不正确");
        } else {
            show_validate_ms("#found_phone", "success", "");
            $.ajax({
                url: "/found_code",
                type: "post",
                dataType: "json",
                data: {"phone": phone},
                success: function (result) {
                    if (result.code === 200) {
                        show_validate_ms("#found_phone", "success", "发送成功，注意查收");
                        checkCode1(60);
                    } else if (result.code === 201) {
                        show_validate_ms("#found_phone", "error", "该号码已注册");
                        checkCode1(2);
                    }
                    // else if(result.code=== 404){
                    //     alert("该手机号码未注册");
                    //     checkCode(2);
                    // }else if(result.code=== 100){
                    //     alert("审核中请稍后。。。");
                    //     checkCode(2);
                    // }else if(result.code=== 500){
                    //     alert("审核未通过。。。");
                    //     checkCode2(2);
                    // }else if(result.code=== 301){
                    //     checkCode2(2);
                    //     alert("余额不足，请联系管理员");
                    // }else if(result.code=== 300){
                    //     checkCode2(60);
                    //     alert("短信发送频率繁忙");
                    // }
                }
            });
        }
    });

    function checkCode1(time) {
        if (time === 0) {
            $("#found_code_btn").removeAttr("disabled");//这个表示，从xx中移除yy属性，$(xx).remove()，移除xx元素
            $("#found_code_btn").html("重新发送");
        } else {
            time--;
            $("#found_code_btn").attr("disabled", true);
            $("#found_code_btn").html("倒计时" + time + "s");
            setTimeout(function () {//setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式。1秒
                checkCode1(time);
            }, 1000);
        }
    }

    function validate_add_form1() {

        var password = $("#found_password").val();
        var regPassword = /(^[a-zA-Z0-9_-]{4,16}$)/;
        if (password.length === 0) {
            show_validate_ms("#found_password", "error", "密码不能为空");
            return false;
        } else if (!regPassword.test(password)) {
            show_validate_ms("#found_password", "error", "密码由4-16位英文和数字的组合");
            return false;
        } else {
            show_validate_ms("#found_password", "success", "");
        }
        //3、校验电话信息
        var phone1 = $("#found_phone").val();
        var regPhone = /^1[3-9]\d{9}$/;
        if (phone1.length === 0) {
            show_validate_ms("#found_phone", "error", "手机号码不能为空");
            return false;
        } else if (!regPhone.test(phone1)) {
            show_validate_ms("#found_phone", "error", "手机号码格式不正确");
            return false;
        } else if (phone !== phone1) {
            show_validate_ms("#found_phone", "error", "手机号码不一致");
            return false;
        } else {
            show_validate_ms("#found_phone", "success", "");
        }
        //4、验证码
        var code = $("#found_code").val();
        if (code.length === 0) {
            show_validate_ms("#found_code", "error", "验证码不能为空");
            return false;
        } else {
            show_validate_ms("#found_code", "success", "");
        }
        return true;
    }


    function found() {
        if (!validate_add_form1()) {
            return false;
        }
        var code = $("#found_code").val();
        $.ajax({
            url: "/found_user/" + code,
            data: $("#found form").serialize(),
            type: "POST",
            dataType: "json",
            success: function (result) {
                if (result.code === 500) {
                    show_validate_ms("#found_code", "error", "验证码错误");
                } else if (result.code === 444) {
                    show_validate_ms("#found_code", "error", "验证码失效");
                } else if (result.code === 100) {
                    reset_form("#found form");
                } else{
                    show_validate_ms("#found_code", "success", "");
                }
                if (result.code === 200) {
                    var login1 = document.getElementById("login");
                    login1.className = login1.className.replace("hide", "show");

                    var found1 = document.getElementById("found");
                    found1.className = found1.className.replace("show", "hide");

                    reset_form("#found form");
                }
            }

        });
    }

    $("#leader_btn").click(function () {
        var phone = $("#leader_phone").val();
        if (phone.length === 0) {
            show_validate_ms("#leader_phone", "error", "账号不能为空");
            return false;
        } else {
            show_validate_ms("#leader_phone", "success", "");
        }

        var password = $("#leader_password").val();
        if (password.length === 0) {
            show_validate_ms("#leader_password", "error", "密码不能为空");
            return false;
        } else {
            show_validate_ms("#leader_password", "success", "");
        }

        $.ajax({
            url: "/lead_login",
            type: "post",
            dataType: "json",
            data: {"phone": phone, "password": password},
            success: function (result) {
                if (result.code === 100) {
                    show_validate_ms("#leader_phone", "error", "此账号无权限");
                    show_validate_ms("#leader_password", "error", "");
                } else if (result.code === 404) {
                    show_validate_ms("#leader_phone", "error", "账号错误");
                    show_validate_ms("#leader_password", "error", "密码错误");
                } else {
                    show_validate_ms("#leader_phone", "success", "");
                    show_validate_ms("#leader_password", "success", "");
                }

                if (result.code === 200) {
                    window.location.href = "#";
                }
            }
        })
    })

    //显示校验结果的提示信息
    function show_validate_ms(ele, status, ms) {
        //清除当前元素的校验状态
        $(ele).parent().removeClass("has-success has-error");
        /*.has-error：错误状态（红色）.has-success：成功状态（绿色） */
        $(ele).next("span").text("");
        if ("success" === status) {
            $(ele).parent().addClass("has-success");
            $(ele).next("span").text(ms);
        } else if ("error" === status) {
            $(ele).parent().addClass("has-error");
            $(ele).next("span").text(ms);
        }
    }


    function s_found() {
        var find1 = document.getElementById("found");
        find1.className = find1.className.replace("hide", "show");
    }

    function s_register() {
        var register1 = document.getElementById("register");
        register1.className = register1.className.replace("hide", "show");
    }

    function s_login() {
        var login1 = document.getElementById("login");
        login1.className = login1.className.replace("hide", "show");
    }

    function s_leader() {
        var leader1 = document.getElementById("leader");
        leader1.className = leader1.className.replace("hide", "show");
    }

    function s_admin() {
        var admin1 = document.getElementById("admin");
        admin1.className = admin1.className.replace("hide", "show");
    }

    function h_found() {
        var find1 = document.getElementById("found");
        find1.className = find1.className.replace("show", "hide");
    }

    function h_register() {
        var register1 = document.getElementById("register");
        register1.className = register1.className.replace("show", "hide");
    }

    function h_login() {
        var login1 = document.getElementById("login");
        login1.className = login1.className.replace("show", "hide");
    }

    function h_leader() {
        var leader1 = document.getElementById("leader");
        leader1.className = leader1.className.replace("show", "hide");
    }

    function h_admin() {
        var admin1 = document.getElementById("admin");
        admin1.className = admin1.className.replace("show", "hide");
    }


    function goto_found() {
        s_found();
        h_register();
        h_admin();
        h_leader();
        h_login();
    }

    function goto_register() {
        s_register();
        h_admin();
        h_leader();
        h_login();
        h_found();
    }

    function goto_login() {
        s_login();
        h_admin();
        h_leader();
        h_found();
        h_register();
    }

    function goto_leader() {
        s_leader();
        h_found();
        h_register();
        h_admin();
        h_login();
    }

    function goto_admin() {
        s_admin();
        h_found();
        h_register();
        h_login();
        h_leader();
    }

    function reset_form(ele) {
        $(ele)[0].reset();
        $(ele).find("*").removeClass("has-error has-success");
        $(ele).find(".help-block").text("");
    }


</script>
</body>
</html>